/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import 'package:example/content_menu_example.dart';
import 'package:example/pan_example.dart';
import 'package:example/pinch_example.dart';
import 'package:example/rotate_example.dart';
import 'package:example/swipe_example.dart';
import 'package:example/tap_example.dart';
import 'package:flutter/material.dart';
import 'package:example/double_tap_example.dart';
import 'package:example/drag_example.dart';
import 'package:example/hover_example.dart';
import 'package:example/long_press_example.dart';

void main() {
  runApp(
    const MaterialApp(
      home: GestureExample(),
    ),
  );
}

class GestureExample extends StatefulWidget {
  const GestureExample({super.key});

  @override
  GestureExampleState createState() => GestureExampleState();
}

class GestureExampleState extends State<GestureExample> {
  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        ElevatedButton(
          child: const Text('滚动平移'),
          onPressed: () {
            // 跳转到第二个页面
            Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => const PanExample()),
            );
          },
        ),
        const SizedBox(
          height: 20,
        ),
        ElevatedButton(
          child: const Text('缩放'),
          onPressed: () {
            // 跳转到第二个页面
            Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => const PinchExample()),
            );
          },
        ),
        const SizedBox(
          height: 20,
        ),
        ElevatedButton(
          child: const Text('旋转'),
          onPressed: () {
            // 跳转到第二个页面
            Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => const RotateExample()),
            );
          },
        ),
        const SizedBox(
          height: 20,
        ),
        ElevatedButton(
          child: const Text('轻扫'),
          onPressed: () {
            // 跳转到第二个页面
            Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => const SwipeExample()),
            );
          },
        ),
        const SizedBox(
          height: 20,
        ),
        ElevatedButton(
          child: const Text('上下文菜单'),
          onPressed: () {
            // 跳转到第二个页面
            Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => const ContentMenuExample()),
            );
          },
        ),
        const SizedBox(
          height: 20,
        ),
        ElevatedButton(
          child: const Text('悬浮'),
          onPressed: () {
            // 跳转到第二个页面
            Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => const HoverExample()),
            );
          },
        ),
        const SizedBox(
          height: 20,
        ),
        ElevatedButton(
          child: const Text('点击'),
          onPressed: () {
            // 跳转到第二个页面
            Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => const TapExample()),
            );
          },
        ),
        const SizedBox(
          height: 20,
        ),
        ElevatedButton(
          child: const Text('长按'),
          onPressed: () {
            // 跳转到第二个页面
            Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => const LongPressExample()),
            );
          },
        ),
        const SizedBox(
          height: 20,
        ),
        ElevatedButton(
          child: const Text('拖拽'),
          onPressed: () {
            // 跳转到第二个页面
            Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => const DragExample()),
            );
          },
        ),
        const SizedBox(
          height: 20,
        ),
        ElevatedButton(
          child: const Text('双击'),
          onPressed: () {
            // 跳转到第二个页面
            Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => const DoubleTapExample()),
            );
          },
        ),
      ],
    );
  }
}
